{include file="common_top.html"}
	{include file="common_head.html"}
	<style type="text/css">
	{literal}
		.ltxt, textarea{width:100%;}
	{/literal}
	</style>
</head>
<body class="mainbody">
	<div class="datatable">
		<h3>
			{if $object.id > 0}
				文件 '{$object.file_name}' 编辑
			{else}
				文件添加
			{/if}
		</h3>
		<form action="/index.php?a=file&m=edit&t=ajax" method="post">
			<input type="hidden" value="{$object.id}" id="object_id" name="id" />
			<div class="data"><table><tbody>
				<tr><th style="width:100px;">文件名</th><td><input type="text" class="txt" name="file_name" value="{$object.file_name}" /></td></tr>
				<tr><th>文件名缩写</th><td><input type="text" class="txt" name="file_name_short" value="{$object.file_name_short}" /></td></tr>
				<tr><th>键名</th><td><input type="text" class="txt" name="name_key" value="{$object.name_key}" /></td></tr>
				<tr><th>值名</th><td><input type="text" class="txt" name="name_val" value="{$object.name_val}" /></td></tr>
				<tr><th>简介</th><td><input type="text" class="txt ltxt" name="desc" value="{$object.desc}" /></td></tr>
				<tr><th>详细</th><td>&nbsp;<br /><textarea name="detail" rows="5" class="txt">{$object.detail}</textarea></td></tr>
				<tr class="pagination"><td colspan="2">
					<div class="button"><input type="submit" class="btn" value="保存" /></div>
				</td></tr>
			</tbody></table></div>
		</form>
	</div>
	<div class="msg"></div>
	<div class="msgdialog" title="保存反馈"></div>
	<script type="text/javascript">
	{literal}
		$("form").submit(function(){
			// Clear
			$(".msg").html("");

			// Submit
			$.fn.dyAjaxForm(this, {dataType: "JSON", onEvent: {success: function(result){
				if(result.state){
					if($("#object_id").val() < 1){
						$(".msgdialog").html(result.message).dialog({
							modal: true, buttons: {
								Ok: function(){window.location.href = result.url;}
							}
						});
					}else{
						$.fn.notificationShow($(".msg"), result.message, "success");
					}
				}else{
					$.fn.notificationShow($(".msg"), result.message, "error");
				}
			}, error: function(jqXHR, textStatus, errorThrown){
				$.fn.notificationShow($(".msg"), "AJAX请求出错[" + errorThrown + "].", "error");
			}}});
			return false;
		});
	{/literal}
	</script>
{include file="common_copyright.html"}
{include file="common_bottom.html"}
